﻿using DNFImagePacks2Manager.Helpers;
using System.Collections.Generic;
using System.IO;

namespace DNFImagePacks2Manager.NPK
{
    public class ImagePointerFile : ImageFile
    {

        public int Pointer { get; set; }

        public ImagePointerFile(BinaryReader reader, ImageType type) : base(type)
        {
            byte[] pointerBytes = reader.ReadBytes(4);
            Pointer = ByteHelper.Bytes2Int(pointerBytes);
        }

        public ImagePointerFile(int pointer) : base(new ImageType(0x11))
        {
            Pointer = pointer;
        }

        public override byte[] GetIndexBytes()
        {
            List<byte> bytes = [];
            bytes.AddRange(Type.GetBytes());
            bytes.AddRange(ByteHelper.Int2Bytes(Pointer));
            return [.. bytes];
        }

        public override int GetSize()
        {
            return 0;
        }

        public override bool IsCompressed()
        {
            return false;
        }
    }
}
